package pers.ree.demo.reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ReflectDemo {

    public static void main(String[] args) {
        test2();
    }

    public static void test2() {
        Class<TestReflectEntity2> studentClass = TestReflectEntity2.class;
        try {
            Method getNameMethod = studentClass.getMethod("getName");
            System.out.println(getNameMethod.isAccessible());

            Field nameField = studentClass.getField("name");
            System.out.println(nameField.isAccessible());
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
    }
}
